$('#distpicker5').distpicker({
    autoSelect: false
});

$('#orderToPay').click(function () {
    var userName = $('#userName').val()
    var phone = $('#phone').val()
    var code = $('#code').val()
    var sheng = $('#province10').val()//省
    var shi = $('#city10').val()//市
    var xian = $('#district10').val()//县
    var addr = $('#address').val()//详细地址
    if (!userName) {
        alert('请输入姓名');
        return
    }
    if (phone.length != 11 || (phone.substring(0, 1) != 1)) {
        alert('请输入正确的手机号码');
        return
    }
    if (code.length <= 4) {
        alert('请检查F码');
        return
    }
    if (!sheng || !shi) {
        alert('请选择地址');
        return
    }
    if (addr.trim().length < 3) {
        alert('请输入街道小区名称等详细地址');
        return
    }
    xian = xian == undefined ? '' : xian
    var form = $('#form');
    var params = {
        data: {
            phone: phone,
            userName: userName,
            province: sheng,
            city: shi,
            area: xian,
            deliveryAddress: sheng + shi + xian + addr,
            fCode: code
        }
    };
    form.append("<input type='hidden' value='" + JSON.stringify(params) + "' name='request'>");
    form.submit();
});